#ifndef LIGHTING_FX
#define LIGHTING_FX

float3 pointLight(float3 surface_pos, float3 surface_normal, float3 light_pos,
	float3 light_color, float3 attenuation, float min_attenuation = 0)
{
	float3 to_light = light_pos - surface_pos;
	float d = length(to_light);
	to_light = normalize(to_light);

	float att_factor = 1 / (attenuation.x + d * attenuation.y + d*d *
		attenuation.z);
	att_factor = max(min_attenuation, att_factor);	
	float amount = max(0, att_factor * dot(to_light, surface_normal));
	return amount * light_color;
}

#endif

